/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package org.jackysoft.opensymphony.workflow.entity;

import java.util.ArrayList;
import java.util.List;

import org.jackysoft.util.ValidationUtils;


/**
 * DOCUMENT ME!
 *
 * 
 */


public class SplitDescriptor extends AbstractDescriptor implements Validatable {
    //~ Instance fields ////////////////////////////////////////////////////////

    /**
	 * 
	 */
	private static final long serialVersionUID = -2846928253615190907L;
	protected List results = new ArrayList();
    protected boolean team = false;

    //~ Constructors ///////////////////////////////////////////////////////////

    /**
     * 
     */
   public  SplitDescriptor() {
    }
    /**
     * 
     */
    public  SplitDescriptor(org.dom4j.Element element) {
    	super(element);this.init(element);
    }

    //~ Methods ////////////////////////////////////////////////////////////////

    
    
    
    
    
    public List getResults() {
        return results;
    }

    
    
    /**
	 * 
	 */
	public void setResults(List results) {
		this.results = results;
	}

	public void validate() throws InvalidWorkflowDescriptorException {
        ValidationUtils.validate(results);
    }
       
    @Override
    protected void init(org.dom4j.Element split) {
    	try {
    		setId(Integer.parseInt(split.attributeValue("id")));
    	} catch (Exception ex) {
    		throw new IllegalArgumentException("Invalid split id value " + split.attributeValue("id"));
    	}
    	super.buildElements(split, "unconditional-result", ResultDescriptor.class, results, this);
    	
    }

	public boolean isTeam() {
		return team;
	}

	public void setTeam(boolean team) {
		this.team = team;
	}
}
